home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / WAIS / next-ui / Doc.h < prev    next >
Encoding:
Text File  |  1992-02-03  |  2.8 KB  |  82 lines

  1. // Doc.h
  2. //
  3. // Free software created 1 Feb 1992
  4. // by Paul Burchard <burchard@math.utah.edu>.
  5. //
  6. // Provides an abstract superclass to act as File's Owner for document
  7. // NIB under the control of a DocControl.  That is, Doc owns the window
  8. // which the user equates with the document, and mediates between this document 
  9. // and the Application (which is represented by its DocControl delegate).  The 
  10. // Doc's (i.e., File's Owner's) window outlet must be connected to the Window 
  11. // in IB.
  12. //
  13. // The Doc object (File's Owner in IB) is set be set to be the Window's 
  14. // delegate in its -init method, but window delegate methods can be
  15. // delegated further by using the Doc object's delegate outlet.
  16. //
  17. // The -textDidChange: action method notifies the window that the document ist 
  18. // contains has been edited and needs to be saved.  One way to use this method 
  19. // is to make the Doc object the delegate of Text objects in the window; they 
  20. // will then report alterations to the text.
  21. //
  22. // The -free method also closes the window in which the Doc lives. Since it
  23. // forces a close, without asking the user or telling the DocControl, programs 
  24. // generally shouldn't call this method directly; use DocControl's 
  25. // -closeDoc:andFree:YES instead.
  26. //
  27. // Subclasses should never directly set the fileName variable;
  28. // use -setFileName: instead.
  29. //
  30. // The following must be implemented by the subclass:
  31. //    - dump:sender            Dump document to fileName; return nil
  32. //                    if fileName==0 or fail (default no-op).
  33. //    - load:sender            Load document from fileName; return nil
  34. //                    if fileName==0 or fail (default no-op).
  35. //
  36. // The following would typically also be implemented by the subclass:
  37. //    + (const char *)fileType    Returns the file type extension 
  38. //                    accepted by class (default "").
  39. //                    Must be an invariant string.
  40. //    + (const char *)nibName        Returns name of NIB section which
  41. //                    sets up document window (default
  42. //                    "Doc.nib").  Must be invariant.
  43. //    + (const char *)miniIconName    Returns name for icon to be displayed
  44. //                    in doc's miniwindow (iconified form).
  45. //                    Default NULL results in no icon.
  46. //    + (BOOL)backupOnSave        Should backup files (~) be created
  47. //                    when saving?  (Default NO.)
  48. //    + (const char *)defaultFolder    Default folder for Open/Save Panels
  49. //                    (default default is home directory).
  50. //
  51.  
  52. #import <objc/Object.h>
  53.  
  54. @interface Doc:Object
  55. {
  56.     id window;
  57.     id delegate;
  58.     const char *fileName;
  59. }
  60.  
  61. + (const char *)fileType;
  62. + (const char *)nibName;
  63. + (const char *)miniIconName;
  64. + (BOOL)backupOnSave;
  65. + (const char *)defaultFolder;
  66. + initialize;
  67. - init;
  68. - free;
  69. - windowWillClose:sender;
  70. - textDidChange:sender;
  71. - setFileName:(const char *)aName;
  72. - (const char *)fileName;
  73. + docForFileName:(const char *)aName;
  74. - dump:sender;
  75. - load:sender;
  76. - window;
  77. - setDelegate:anObject;
  78. - delegate;
  79. - forward:(SEL)aSelector :(marg_list)argFrame;
  80.  
  81. @end
  82.